<template>
  <view class="container">
    <view class="header_txt">
      <view class="back"
            @click="backHandler">
        <image src="/static/img/back3.png"></image>
      </view>
      <view class="title"> 时政热点 </view>
    </view>
    <view class="box">
      <view class="top_kong"></view>
      <view class="center">
        <view class="pay_title">
          <view class="pay_line"></view>
          课程基本信息
        </view>
        <block v-if='categorytype == 3'>
          <!-- 渲染助攻 -->
          <view class="center_list flexs2">
            <image class="center_image"
                   :src="$serverIPimg+curriculumDetailList.image"
                   mode=""></image>
            <view class="center_right">
              <view class="top_titles">
                curriculumDetailList.name
              </view>
              <view class="flexs2">
                <view class="flexs1">
                  <view class="cemter_last"><text class="fwt">￥</text>curriculumDetailList.price</view>
                  <view class="nub_hui"></view>
                  <!-- ￥{{InfoList.original_price}} -->
                </view>
                <view class="vipmo">
                  VIP:￥curriculumDetailList.discount_price
                </view>
              </view>
            </view>
          </view>
        </block>
        <block v-if='categorytype == 1'>
          <!-- 渲染课程 -->
          <view class="center_list flexs2">
            <image class="center_image"
                   :src="$serverIp+curriculumDetailList.image"
                   mode=""></image>
            <view class="center_right">
              <view class="top_titles">
                {{curriculumDetailList.name}}
              </view>
              <view class="flexs2">
                <view class="flexs1">
                  <view class="cemter_last"><text class="fwt">￥</text>{{curriculumDetailList.now_price}}</view>
                  <view class="nub_hui">￥{{curriculumDetailList.original_price}}</view>
                </view>
                <view class="vipmo">
                  VIP:￥{{curriculumDetailList.discount_price}}
                </view>
              </view>
            </view>
          </view>
        </block>
        <block v-if='categorytype == 2'>
          <!-- 渲染试题 -->
          <view class="center_list flexs2">
            <image class="center_image"
                   src="../../static/image/sy_img_bskc@2x.png"
                   mode=""></image>
            <view class="center_right">
              <view class="top_titles">
                {{curriculumDetailList.name}}
              </view>
              <view class="flexs2">
                <view class="flexs1">
                  <view class="cemter_last"><text class="fwt">￥</text>{{curriculumDetailList.now_price}}</view>
                  <view class="nub_hui">￥{{curriculumDetailList.original_price}}</view>
                </view>
                <view class="vipmo">
                  VIP:￥{{curriculumDetailList.discount_price}}
                </view>
              </view>
            </view>
          </view>
        </block>
      </view>
      <view class="border_bo">
        <view class="pay_title"
              style="padding-left: 30rpx;">
          <view class="pay_line"></view>
          支付信息
        </view>
        <view class="pay_item"
              @click="choosetype(1)">
          <image class="pay_icon1"
                 src="../../static/image/ico_wx@2x.png"></image>
          <view class="pay_right_box">
            <view class="pay_title1">微信支付</view>
            <view class="pay_selicon">
              <image src="../../static/image/ddjs_ico_xz_sel@2x.png"
                     v-if="type==1"></image>
              <image src="../../static/image/ddjs_ico_xz_nor@2x.png"
                     v-else></image>
            </view>
          </view>
        </view>
        <view class="pay_item"
              @click="choosetype(2)">
          <image class="pay_icon"
                 src="../../static/image/ico_zfb@2x.png"></image>
          <view class="pay_right_box">
            <view class="pay_title1">支付宝支付</view>
            <view class="pay_selicon">
              <image src="../../static/image/ddjs_ico_xz_sel@2x.png"
                     v-if="type==2"></image>
              <image src="../../static/image/ddjs_ico_xz_nor@2x.png"
                     v-else></image>
            </view>
          </view>
        </view>
        <view class="pay_item"
              @click="choosetype(0)"
              style="border-bottom:none">
          <image class="pay_icon"
                 src="../../static/image/ico_ye@2x.png"></image>
          <view class="pay_right_box">
            <view class="pay_title1">余额支付</view>
            <view class="pay_selicon">
              <image src="../../static/image/ddjs_ico_xz_sel@2x.png"
                     v-if="type==0"></image>
              <image src="../../static/image/ddjs_ico_xz_nor@2x.png"
                     v-else></image>
            </view>
          </view>
        </view>
      </view>
      <view class="btns"
            @click="tomima"
            v-if="type==0">立即支付</view>
      <view class="btns"
            @click="goPay(categorytype)"
            v-else>立即支付</view>
      <!-- 支付密码 -->
      <passkeyborad :show="show"
                    @close="close"
                    @makesure="makesure"></passkeyborad>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return { curriculumDetailList: {}, categorytype: '', type: 1, show: { showStatus: false } }
  },
  onLoad(options) {
    // console.log(options)
    this.categorytype = options.type
    this.getCurriculumDetailList(options.id)
  },
  methods: {
    backHandler() {
      uni.navigateBack({
        delta: 1
      })
    },
    choosetype(val) {
      // val:0余额,1微信,2支付宝
      this.type = val
    },
    //Curriculum/detail
    async getCurriculumDetailList(id) {
      const { data } = await this.$http.post('/Curriculum/detail', { c_id: id })
      console.log(data)
      this.curriculumDetailList = data.data
    }
  }
}
</script>

<style lang="scss">
.flexs1 {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.flexs2 {
  display: flex;
  justify-content: space-between;
}
/* 头部区域 */
.header_txt {
  width: 750rpx;
  overflow: hidden;
  height: 88rpx;
  line-height: 88rpx;
  background-color: #fff;

  .back {
    position: absolute;
    top: 14rpx;
    left: 14rpx;
    width: 60rpx;
    height: 60rpx;
    display: flex;
    justify-content: center;
    align-items: center;
    image {
      width: 48rpx;
      height: 48rpx;
    }
  }

  .right {
    position: absolute;
    top: 14rpx;
    right: 14rpx;
    width: 60rpx;
    height: 60rpx;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .title {
    text-align: center;
    height: 88rpx;
    // margin-top: -20rpx;
    // line-height: 88rpx;
    font-size: 32rpx;
    font-weight: bold;
  }
}
.box {
  width: 100%;
  height: 100%;
  /* background-color: #F5F5F5; */
}

.border_bo {
  width: 100%;
  height: auto;
  background-color: #ffffff;
  margin-top: 20rpx;
}

/* cemter */
.center {
  width: 100%;
  height: auto;
  padding: 10rpx 30rpx;
  background-color: #ffffff;
}

.vipmo {
  width: auto;
  line-height: 40rpx;
  background: #ffe7e6;
  border-radius: 6rpx;
  font-size: 26rpx;
  color: #ff3b30;
  padding: 0 10rpx;
  margin-right: 10rpx;
}

.center_pay {
  font-size: 22rpx;
  color: #999999;
}

.cemter_last {
  height: 40rpx;
  font-size: 34rpx;
  color: #ff3b30;
  font-weight: bold;
}

.center_study {
  margin-top: 6rpx;
  color: #666666;
  font-size: 24rpx;
}

.center_right {
  width: 475rpx;
  height: auto;
  padding: 20rpx 0 0 0;
}

.top_titles {
  width: 458rpx;
  height: 90rpx;
  font-size: 28rpx;
  font-family: PingFang SC;
  font-weight: bold;
  line-height: 42rpx;
  color: #333333;
  font-size: 28rpx;
  max-height: 90rpx;
  overflow: hidden;
  word-break: break-all;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.center_image {
  width: 196rpx;
  height: 130rpx;
  border-radius: 10rpx;
}

.fwt {
  font-size: 24rpx;
}

.top_kong {
  width: 100%;
  height: 20rpx;
  background-color: #f5f5f5;
}

.nub_hui {
  height: 30rpx;
  font-size: 20rpx;
  color: #999999;
  margin-left: 6rpx;
  text-decoration: line-through;
}

.top-kong {
  width: 100%;
  height: var(--status-bar-height);
  background-color: #ffffff;
}

.border {
  width: 100%;
  height: 100rpx;
  padding: 0 30rpx;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #ffffff;
}

.border image {
  width: 20rpx;
  height: 36rpx;
}

.border_start {
  display: flex;
  align-items: center;
}

.border_title {
  font-size: 34rpx;
  font-family: PingFang SC;
  font-weight: 500;
  color: #303030;
}

.border_end {
  font-size: 28rpx;
  font-family: PingFang SC;
  font-weight: 500;
  color: #333333;
  text-align: end;
}

.border_end image {
  width: 33rpx;
  height: 36rpx;
}

.item_box {
  width: 100%;
  height: 700rpx;
  background: #ffffff;
  border-radius: 10rpx;
  margin: 0 auto;
  overflow: hidden;
}

.top_item {
  width: 100%;
  height: 300rpx;
  color: #ff4145;
  font-size: 72rpx;
  background-color: #f5f5f5;
  text-align: center;
  padding: 80rpx;
}

.top_price {
  font-size: 72rpx;
  font-weight: bold;
  color: #ff4145;
}

.top_ordernum {
  font-size: 24rpx;
  color: #333333;
}

.pay_item {
  width: 96%;
  height: 100rpx;
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* border-bottom: solid 1rpx #E5E5E5; */
  margin-left: 4%;
  padding-right: 30rpx;
}
.pay_right_box {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  border-bottom: solid 1rpx #f5f5f5;
}

.pay_title {
  width: 100%;
  height: 90rpx;
  display: flex;
  align-items: center;
  font-size: 34rpx;
}

.pay_title1 {
  width: 580rpx;
  height: 100rpx;
  display: flex;
  align-items: center;
  font-size: 28rpx;
}

.pay_icon {
  width: 38rpx;
  height: 40rpx;
}

.pay_icon1 {
  width: 40rpx;
  height: 35rpx;
}

.pay_selicon {
  width: 36rpx;
  height: 36rpx;
}

.pay_selicon image {
  width: 36rpx;
  height: 36rpx;
}

.btns {
  width: 86%;
  height: 88rpx;
  background: #ffdd47;
  border-radius: 10rpx;
  margin: 80rpx auto 0;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 30rpx;
  color: #333333;
  position: absolute;
  bottom: 3%;
  left: 6.7%;
}

.njpns {
  width: 36rpx;
  height: 36rpx;
}

.pay_title {
  width: 100%;
  height: 100rpx;
  /* padding: 0 30rpx; */
  /* font-size: 34rpx; */
  font-family: PingFang SC;
  font-weight: 500;
  color: #333333;
}

.pay_line {
  width: 4rpx;
  height: 20rpx;
  background: #ffdd47;
  border-radius: 2rpx;
  margin-right: 10rpx;
}
</style>
